Run Validator: Lodestar
The Validator requires a Consensus Client (also known as Beacon Node) in order to operate. See Step 3: Run Beacon Node - Lodestar for more information.
Option 1: Run as System Process
Refer to Guide
Option 2: Run using Docker
1. Folder Structure
Create new folders:
mkdir /home/$USER/gnosis/consensus/keystores
/home/$USER/gnosis/
├── jwtsecret/
├── execution/
└── consensus/
├── data/
└── keystores/
2. Docker Compose
Modify your docker-compose file with your favorite text editor and add the validator container. You will also need to add the command --suggestedFeeRecipient=$FEE_RECIPIENT to your consensus container. The file should now look like:
version: "3"
services:
execution:
# From Step 2
# ...
consensus:
# From Step 3
# ...
validator:
container_name: validator
image: chainsafe/lodestar:latest
restart: always
networks:
- gnosis_net
ports:
- 5064:5064/tcp
volumes:
- /home/$USER/gnosis/consensus/validators:/data/validators
- /home/$USER/gnosis/consensus/keystores:/keystores
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- NODE_OPTIONS=--max-old-space-size=4096
command: |
validator
--network=gnosis
--dataDir=/data/validators
--logFile=/data/validators/logs/validator.log
--logFileLevel=info
--beaconNodes=http://consensus:4000
--metrics=true
--metrics.address=0.0.0.0
--metrics.port=5064
--suggestedFeeRecipient=$FEE_RECIPIENT
--graffiti=$GRAFFITI
--importKeystores=/keystores
--importKeystoresPassword=/keystores/password.txt
logging:
driver: "local"
networks:
gnosis_net:
name: gnosis_net
3. Environment Variables
Add an .env file with your fee recipient (your Gnosis address) and graffiti in /home/$USER/gnosis/.env.
FEE_RECIPIENT=0x0000000000000000000000000000000000000000
GRAFFITI=gnosischain/lodestar
Replace suggestedFeeRecipient with your Gnosis address. This fee recipient address will receive tips from user transactions from the block the validator proposed. If not set, the tips will be sent to zero address, that is burnt completely. It is strongly recommended that you configure this value in your setup.
Learn more about suggestedFeeRecipient flag in Lodestar docs.
Replace graffiti with your own graffiti. It is an optional field that can be used to add a message to the block by the proposer.
4. Keystore Location
Add your keystores in /home/$USER/gnosis/consensus/keystores/ and their password in a file /home/$USER/gnosis/consensus/keystores/password.txt to get this file structure:
/home/$USER/gnosis/
├── docker-compose.yml
├── .env
├── jwtsecret/
├── execution/
└── consensus/
├── data/
└── keystores/
├── keystore-001.json
├── keystore-002.json
└── password.txt
5. Import Keystores
Import your validators:
When the Lodestar validator container starts, it will search the directories for the keystores and password, and import them automatically.